SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		?Autor
-- Create date: ?Fecha
-- Description:	?Descripcion
-- =============================================
CREATE TRIGGER [?Esquema].[Actualizar?NomTabla]
ON [?Esquema].[?NomTabla]
AFTER UPDATE
AS 
BEGIN
	SET NOCOUNT ON;

	DECLARE curDel CURSOR LOCAL FOR 
					SELECT ?CamposBaseDatos
					FROM   deleted;
	DECLARE curIns CURSOR LOCAL FOR 
					SELECT ?CamposBaseDatos
					FROM   inserted;
									
    DECLARE ?DeclareAnt
								
	DECLARE ?DeclareNuevo
	
    DECLARE @vAccion AS VARCHAR(4000)

    OPEN curDel;
    OPEN curIns;
    
    FETCH curDel INTO ?VariablesAnt
						
	FETCH curIns INTO ?VariablesNuevo
    
	SET @vAccion='';
	
?Condiciones
	
	INSERT obd.LOGMOVIMIENTOS (tabla, idReg, fecha, 
							   user_Id, accion)
    VALUES ('?NomTabla', @vIdReg, GETDATE(), 
			@vUser_Id, @vAccion)
    
END
GO
